﻿#include "mTestWidget.h"
#include "ui_mTestWidget.h"
#include <QGridLayout>
#include "stable.h"




mTestWidget::mTestWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::mTestWidget)
{
    ui->setupUi(this);
    QGridLayout* pGridLayout = new QGridLayout();
    pGridLayout->addWidget(ui->m_pLineEdit1,0,0);
    pGridLayout->addWidget(ui->m_pSpinBox1,1,0);
    pGridLayout->addWidget(ui->m_pHorizontalSlider1,2,0);

    ui->m_pLineEdit1->setReadOnly(true);
    ui->m_pSpinBox1->setMinimum(10);
    ui->m_pSpinBox1->setMaximum(90);


    void(QSpinBox::*spSignal)(int) = &QSpinBox::valueChanged;
    connect(ui->m_pSpinBox1, spSignal, ui->m_pHorizontalSlider1, &QSlider::setValue);

    connect(ui->m_pHorizontalSlider1, &QSlider::valueChanged, ui->m_pSpinBox1, &QSpinBox::setValue);

    setLayout(pGridLayout);
}



mTestWidget::~mTestWidget()
{
    delete ui;
}



void mTestWidget::SetNum(int nNum)
{
    ui->m_pSpinBox1->setValue(nNum);
}



int mTestWidget::GetNum()
{
    return ui->m_pSpinBox1->value();
}
